package demoMod.stsconsole.utils;

import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
import demoMod.stsconsole.interfaces.CustomSavable;

import java.util.Map;

public class JsonParser {
    public static final TypeToken<Map<String, Object>> stringObjectMap = new TypeToken<Map<String, Object>>(){};

    public static <T extends JsonElement, U> U fromJson(T jsonElement, TypeToken<U> typeToken) {
        return CustomSavable.saveFileGson.fromJson(jsonElement, typeToken.getType());
    }
}
